<?php
/**
 * Created by 张彪.
 * User: 小马出行
 * Date: 2018/1/20
 * Time: 13:13
 */
namespace app\admin\model;

use think\Db;
use think\model;
class ScheduleModel extends Model
{

    public function getSchedule($map,$field='a.*',$flag=true,$page=1,$limit=10)
    {
        return $flag ? Db::name('css_schedule a')->join('admin b','a.admin_id=b.admin_id','LEFT')
            ->join(['inter_custom'=>'c'],'c.admin_id = a.admin_id','LEFT')
            ->where($map)->field($field)->page($page,$limit)->order('id desc')->select()
            : Db::name('css_schedule a')->join('admin b','a.admin_id=b.admin_id','LEFT')
                ->where($map)->field($field)->find();
    }

    public function scheduleCount($map)
    {
        return Db::name('css_schedule a')->join('admin b','a.admin_id=b.admin_id','LEFT')
            ->join(['inter_custom'=>'c'],'c.admin_id = a.admin_id','LEFT')
            ->where($map)->count();
    }

}